package patterns.strategy;

/**
 * Created by lenovo on 2016/12/9 0009.
 * 演示策略模式
 */
public class StrategyPatternDemo {
    public static void main(String[] args){
        Context context = new Context(new OperationAdd());
        System.out.println("1+2="+context.executeStrategy(1,2));

        context = new Context(new OperationSubstract());

        System.out.println("2-1="+context.executeStrategy(2,1));

        context = new Context(new OperationMultiply());

        System.out.println("1*2="+context.executeStrategy(1,2));
    }
}
